package lambda表达式;


import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

/**
 * @ClassName LambdaStudy
 * @Author swj
 * @Date 2020/10/13 15:48
 */
public class LambdaStudy {

    public static void main(String[] args) {
        LambdaStudy lambdaStudy = new LambdaStudy();
        lambdaStudy.get("hello",(x)-> System.out.println(x));
        List<String> list = new ArrayList<>();
        List<String> list1 = new ArrayList<>();
        list.add("hello0");list.add("hello1");list.add("hello2");list.add("hello3");list.add("hello4");
        List<String> list2 = list.stream().filter(e->e.contains("0")).limit(2).collect(Collectors.toList());


        System.out.println(list2);
    }

    public void get(String msg , Consumer consumer){
        consumer.accept(msg);
    }
}
